package com.geeker.module.common.util;

import cn.hutool.extra.spring.SpringUtil;
import com.geeker.common.core.domain.AccessUser;
import com.geeker.common.core.service.TokenService;
import com.geeker.module.sys.user.domain.SysUser;
import com.geeker.module.sys.user.sevice.SysUserService;

public class AdminTools {

    public static AccessUser getAccessUser() {
        return SpringUtil.getBean(TokenService.class).getAccessUser();
    }

    public static String getUserName() {
        return getAccessUser().getUserName();
    }

    public static String getNickName() {
        return getAccessUser().getNickName();
    }

    public static SysUser getSysUser() {
        Long userId = getAccessUser().getUserId();
        return SpringUtil.getBean(SysUserService.class).getById(userId);
    }
}
